package qldc.pm.tiensu.constants;

public enum ChucNangPhanMemPermision {
	TIENSU_NCTS ("TIENSU_NCTS", TienSuConstants.QUAN_LY_NGUOI_CO_TIEN_SU, "nguoi_co_tien_su/quan_ly_nguoi_co_tien_su.jsp"),
	TIENSU_YCTL ("TIENSU_YCTL", TienSuConstants.QUAN_LY_YEU_CAU_TRICH_LUC, "trich_luc_tien_su/quan_ly_yeu_cau_trich_luc.jsp"),
	TIENSU_YCXAT ("TIENSU_YCXAT", TienSuConstants.QUAN_LY_YEU_CAU_XOA_AN_TICH, "xoa_an_tich/quan_ly_yeu_cau_xoa_an_tich.jsp"),
	TIENSU_BCTK ("TIENSU_BCTK", TienSuConstants.BAO_CAO_THONG_KE, "bao_cao_thong_ke/bao_cao_thong_ke.jsp"),
	TIENSU_LAPBIENBAN ("TIENSU_LAPBIENBAN", TienSuConstants.LAP_BIEN_BAN_BAN_GIAO_HO_SO, "lap_bien_ban_ban_giao_ho_so/quan_ly_bien_ban_ban_giao_ho_so.jsp"),
	DS_BKTT ("DS_BKTT", TienSuConstants.DS_BKTT, "bao_cao_thong_ke/danh_sach.jsp");

	private final String prefix_path = "/html/tiensu/";
	private final String maChucNang;
	private final String chucNang;
	private final String path;

	ChucNangPhanMemPermision(String maChucNang, String chucNang, String path) {
		this.maChucNang = maChucNang;
		this.chucNang = chucNang;
		this.path = path;
	}

	public String getMaChucNang() {
		return this.maChucNang;
	}

	public String getChucNang() {
		return this.chucNang;
	}

	public String getPath() {
		return prefix_path + path;
	}

	public static ChucNangPhanMemPermision fromMaChucNang(String maChucNang) {
		ChucNangPhanMemPermision[] chucNangPhanMemPermisions = values();

		for (ChucNangPhanMemPermision chucNangPhanMemPermision : chucNangPhanMemPermisions) {
			if(chucNangPhanMemPermision.getMaChucNang().equals(maChucNang)) {
				return chucNangPhanMemPermision;
			}
		}

		return null;
	}
}
